package com.gitee.cirnochat.common.event.listener;

import com.gitee.cirnochat.common.event.UserRegisterEvent;
import com.gitee.cirnochat.user.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class UserRegisterListener {
    private final UserService userService;

    /**
     * 用户注册事件监听器
     * @param event 用户注册事件
     */
    @EventListener(classes = UserRegisterEvent.class)
    public void handleUserRegisterEvent(UserRegisterEvent event) {
        userService.initUserInfo(event.getUserId());
    }
}
